package com.example.skyline.Utils;

import cn.hutool.crypto.SecureUtil;

import java.util.Random;

public class CipherUtils {

    private static char[] hex = { '0', '1', '2', '3', '4', '5', '6', '7', '8',
            '9', 'A', 'B', 'C', 'D', 'E', 'F' };

    // 生成的盐
    public static String salt() {
        Random random = new Random();
        StringBuilder sb = new StringBuilder(16);
        for (int i = 0; i < sb.capacity(); i++) {
            sb.append(hex[random.nextInt(16)]);
        }
        return sb.toString();
    }

    public static void main(String[] args) {
        String salt = salt();
        System.out.println(salt);
        System.out.println(SecureUtil.md5("123456" + salt));
    }

}
